\(\int (a+i a \tan (e+f x)) (A+B \tan (e+f x)) (c-i c \tan (e+f x))^3 \, dx\) [667]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [B] (verification not implemented)
   Maxima [A] (verification not implemented)
   Giac [B] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 39, antiderivative size = 59 \[ \int (a+i a \tan (e+f x)) (A+B \tan (e+f x)) (c-i c \tan (e+f x))^3 \, dx=\frac {a (i A+B) c^3 (1-i \tan (e+f x))^3}{3 f}-\frac {a B c^3 (1-i \tan (e+f x))^4}{4 f} \]

[Out]

1/3*a*(I*A+B)*c^3*(1-I*tan(f*x+e))^3/f-1/4*a*B*c^3*(1-I*tan(f*x+e))^4/f

Rubi [A] (verified)

Time = 0.10 (sec) , antiderivative size = 59, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.051, Rules used = {3669, 45} \[ \int (a+i a \tan (e+f x)) (A+B \tan (e+f x)) (c-i c \tan (e+f x))^3 \, dx=\frac {a c^3 (B+i A) (1-i \tan (e+f x))^3}{3 f}-\frac {a B c^3 (1-i \tan (e+f x))^4}{4 f} \]

[In]

Int[(a + I*a*Tan[e + f*x])*(A + B*Tan[e + f*x])*(c - I*c*Tan[e + f*x])^3,x]

[Out]

(a*(I*A + B)*c^3*(1 - I*Tan[e + f*x])^3)/(3*f) - (a*B*c^3*(1 - I*Tan[e + f*x])^4)/(4*f)

Rule 45

Int[((a_.) + (b_.)*(x_))^(m_.)*((c_.) + (d_.)*(x_))^(n_.), x_Symbol] :> Int[ExpandIntegrand[(a + b*x)^m*(c + d
*x)^n, x], x] /; FreeQ[{a, b, c, d, n}, x] && NeQ[b*c - a*d, 0] && IGtQ[m, 0] && ( !IntegerQ[n] || (EqQ[c, 0]
&& LeQ[7*m + 4*n + 4, 0]) || LtQ[9*m + 5*(n + 1), 0] || GtQ[m + n + 2, 0])

Rule 3669

Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_.)*((A_.) + (B_.)*tan[(e_.) + (f_.)*(x_)])*((c_) + (d_.)*tan[(e_
.) + (f_.)*(x_)])^(n_.), x_Symbol] :> Dist[a*(c/f), Subst[Int[(a + b*x)^(m - 1)*(c + d*x)^(n - 1)*(A + B*x), x
], x, Tan[e + f*x]], x] /; FreeQ[{a, b, c, d, e, f, A, B, m, n}, x] && EqQ[b*c + a*d, 0] && EqQ[a^2 + b^2, 0]

Rubi steps \begin{align*} \text {integral}& = \frac {(a c) \text {Subst}\left (\int (A+B x) (c-i c x)^2 \, dx,x,\tan (e+f x)\right )}{f} \\ & = \frac {(a c) \text {Subst}\left (\int \left ((A-i B) (c-i c x)^2+\frac {i B (c-i c x)^3}{c}\right ) \, dx,x,\tan (e+f x)\right )}{f} \\ & = \frac {a (i A+B) c^3 (1-i \tan (e+f x))^3}{3 f}-\frac {a B c^3 (1-i \tan (e+f x))^4}{4 f} \\ \end{align*}

Mathematica [A] (verified)

Time = 3.13 (sec) , antiderivative size = 70, normalized size of antiderivative = 1.19 \[ \int (a+i a \tan (e+f x)) (A+B \tan (e+f x)) (c-i c \tan (e+f x))^3 \, dx=-\frac {a c^3 \left (3 B-12 A \tan (e+f x)+(12 i A-6 B) \tan ^2(e+f x)+4 (A+2 i B) \tan ^3(e+f x)+3 B \tan ^4(e+f x)\right )}{12 f} \]

[In]

Integrate[(a + I*a*Tan[e + f*x])*(A + B*Tan[e + f*x])*(c - I*c*Tan[e + f*x])^3,x]

[Out]

-1/12*(a*c^3*(3*B - 12*A*Tan[e + f*x] + ((12*I)*A - 6*B)*Tan[e + f*x]^2 + 4*(A + (2*I)*B)*Tan[e + f*x]^3 + 3*B
*Tan[e + f*x]^4))/f

Maple [A] (verified)

Time = 0.14 (sec) , antiderivative size = 56, normalized size of antiderivative = 0.95

method result size
risch \(\frac {4 a \,c^{3} \left (2 i A \,{\mathrm e}^{2 i \left (f x +e \right )}+2 B \,{\mathrm e}^{2 i \left (f x +e \right )}+2 i A -B \right )}{3 f \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right )^{4}}\) \(56\)
derivativedivides \(\frac {a \,c^{3} \left (-\frac {B \tan \left (f x +e \right )^{4}}{4}-\frac {\left (2 i B +A \right ) \tan \left (f x +e \right )^{3}}{3}-\frac {\left (2 i A -B \right ) \tan \left (f x +e \right )^{2}}{2}+A \tan \left (f x +e \right )\right )}{f}\) \(63\)
default \(\frac {a \,c^{3} \left (-\frac {B \tan \left (f x +e \right )^{4}}{4}-\frac {\left (2 i B +A \right ) \tan \left (f x +e \right )^{3}}{3}-\frac {\left (2 i A -B \right ) \tan \left (f x +e \right )^{2}}{2}+A \tan \left (f x +e \right )\right )}{f}\) \(63\)
norman \(\frac {A a \,c^{3} \tan \left (f x +e \right )}{f}-\frac {\left (2 i B a \,c^{3}+A a \,c^{3}\right ) \tan \left (f x +e \right )^{3}}{3 f}+\frac {\left (-2 i A a \,c^{3}+B a \,c^{3}\right ) \tan \left (f x +e \right )^{2}}{2 f}-\frac {B a \,c^{3} \tan \left (f x +e \right )^{4}}{4 f}\) \(91\)
parallelrisch \(-\frac {8 i B \tan \left (f x +e \right )^{3} a \,c^{3}+3 B \tan \left (f x +e \right )^{4} a \,c^{3}+12 i A \tan \left (f x +e \right )^{2} a \,c^{3}+4 A \tan \left (f x +e \right )^{3} a \,c^{3}-6 B \tan \left (f x +e \right )^{2} a \,c^{3}-12 A \tan \left (f x +e \right ) a \,c^{3}}{12 f}\) \(97\)
parts \(\frac {\left (-2 i A a \,c^{3}+B a \,c^{3}\right ) \ln \left (1+\tan \left (f x +e \right )^{2}\right )}{2 f}+\frac {\left (-2 i B a \,c^{3}-A a \,c^{3}\right ) \left (\frac {\tan \left (f x +e \right )^{3}}{3}-\tan \left (f x +e \right )+\arctan \left (\tan \left (f x +e \right )\right )\right )}{f}+A a \,c^{3} x -\frac {2 i A a \,c^{3} \left (\frac {\tan \left (f x +e \right )^{2}}{2}-\frac {\ln \left (1+\tan \left (f x +e \right )^{2}\right )}{2}\right )}{f}-\frac {2 i B a \,c^{3} \left (\tan \left (f x +e \right )-\arctan \left (\tan \left (f x +e \right )\right )\right )}{f}-\frac {B a \,c^{3} \left (\frac {\tan \left (f x +e \right )^{4}}{4}-\frac {\tan \left (f x +e \right )^{2}}{2}+\frac {\ln \left (1+\tan \left (f x +e \right )^{2}\right )}{2}\right )}{f}\) \(192\)

[In]

int((a+I*a*tan(f*x+e))*(A+B*tan(f*x+e))*(c-I*c*tan(f*x+e))^3,x,method=_RETURNVERBOSE)

[Out]

4/3*a*c^3*(2*I*A*exp(2*I*(f*x+e))+2*B*exp(2*I*(f*x+e))+2*I*A-B)/f/(exp(2*I*(f*x+e))+1)^4

Fricas [A] (verification not implemented)

none

Time = 0.23 (sec) , antiderivative size = 86, normalized size of antiderivative = 1.46 \[ \int (a+i a \tan (e+f x)) (A+B \tan (e+f x)) (c-i c \tan (e+f x))^3 \, dx=-\frac {4 \, {\left (2 \, {\left (-i \, A - B\right )} a c^{3} e^{\left (2 i \, f x + 2 i \, e\right )} + {\left (-2 i \, A + B\right )} a c^{3}\right )}}{3 \, {\left (f e^{\left (8 i \, f x + 8 i \, e\right )} + 4 \, f e^{\left (6 i \, f x + 6 i \, e\right )} + 6 \, f e^{\left (4 i \, f x + 4 i \, e\right )} + 4 \, f e^{\left (2 i \, f x + 2 i \, e\right )} + f\right )}} \]

[In]

integrate((a+I*a*tan(f*x+e))*(A+B*tan(f*x+e))*(c-I*c*tan(f*x+e))^3,x, algorithm="fricas")

[Out]

-4/3*(2*(-I*A - B)*a*c^3*e^(2*I*f*x + 2*I*e) + (-2*I*A + B)*a*c^3)/(f*e^(8*I*f*x + 8*I*e) + 4*f*e^(6*I*f*x + 6
*I*e) + 6*f*e^(4*I*f*x + 4*I*e) + 4*f*e^(2*I*f*x + 2*I*e) + f)

Sympy [B] (verification not implemented)

Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 136 vs. \(2 (46) = 92\).

Time = 0.28 (sec) , antiderivative size = 136, normalized size of antiderivative = 2.31 \[ \int (a+i a \tan (e+f x)) (A+B \tan (e+f x)) (c-i c \tan (e+f x))^3 \, dx=\frac {8 i A a c^{3} - 4 B a c^{3} + \left (8 i A a c^{3} e^{2 i e} + 8 B a c^{3} e^{2 i e}\right ) e^{2 i f x}}{3 f e^{8 i e} e^{8 i f x} + 12 f e^{6 i e} e^{6 i f x} + 18 f e^{4 i e} e^{4 i f x} + 12 f e^{2 i e} e^{2 i f x} + 3 f} \]

[In]

integrate((a+I*a*tan(f*x+e))*(A+B*tan(f*x+e))*(c-I*c*tan(f*x+e))**3,x)

[Out]

(8*I*A*a*c**3 - 4*B*a*c**3 + (8*I*A*a*c**3*exp(2*I*e) + 8*B*a*c**3*exp(2*I*e))*exp(2*I*f*x))/(3*f*exp(8*I*e)*e
xp(8*I*f*x) + 12*f*exp(6*I*e)*exp(6*I*f*x) + 18*f*exp(4*I*e)*exp(4*I*f*x) + 12*f*exp(2*I*e)*exp(2*I*f*x) + 3*f
)

Maxima [A] (verification not implemented)

none

Time = 0.35 (sec) , antiderivative size = 72, normalized size of antiderivative = 1.22 \[ \int (a+i a \tan (e+f x)) (A+B \tan (e+f x)) (c-i c \tan (e+f x))^3 \, dx=-\frac {3 \, B a c^{3} \tan \left (f x + e\right )^{4} + 4 \, {\left (A + 2 i \, B\right )} a c^{3} \tan \left (f x + e\right )^{3} - 6 \, {\left (-2 i \, A + B\right )} a c^{3} \tan \left (f x + e\right )^{2} - 12 \, A a c^{3} \tan \left (f x + e\right )}{12 \, f} \]

[In]

integrate((a+I*a*tan(f*x+e))*(A+B*tan(f*x+e))*(c-I*c*tan(f*x+e))^3,x, algorithm="maxima")

[Out]

-1/12*(3*B*a*c^3*tan(f*x + e)^4 + 4*(A + 2*I*B)*a*c^3*tan(f*x + e)^3 - 6*(-2*I*A + B)*a*c^3*tan(f*x + e)^2 - 1
2*A*a*c^3*tan(f*x + e))/f

Giac [B] (verification not implemented)

Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 99 vs. \(2 (49) = 98\).

Time = 0.52 (sec) , antiderivative size = 99, normalized size of antiderivative = 1.68 \[ \int (a+i a \tan (e+f x)) (A+B \tan (e+f x)) (c-i c \tan (e+f x))^3 \, dx=-\frac {4 \, {\left (-2 i \, A a c^{3} e^{\left (2 i \, f x + 2 i \, e\right )} - 2 \, B a c^{3} e^{\left (2 i \, f x + 2 i \, e\right )} - 2 i \, A a c^{3} + B a c^{3}\right )}}{3 \, {\left (f e^{\left (8 i \, f x + 8 i \, e\right )} + 4 \, f e^{\left (6 i \, f x + 6 i \, e\right )} + 6 \, f e^{\left (4 i \, f x + 4 i \, e\right )} + 4 \, f e^{\left (2 i \, f x + 2 i \, e\right )} + f\right )}} \]

[In]

integrate((a+I*a*tan(f*x+e))*(A+B*tan(f*x+e))*(c-I*c*tan(f*x+e))^3,x, algorithm="giac")

[Out]

-4/3*(-2*I*A*a*c^3*e^(2*I*f*x + 2*I*e) - 2*B*a*c^3*e^(2*I*f*x + 2*I*e) - 2*I*A*a*c^3 + B*a*c^3)/(f*e^(8*I*f*x
+ 8*I*e) + 4*f*e^(6*I*f*x + 6*I*e) + 6*f*e^(4*I*f*x + 4*I*e) + 4*f*e^(2*I*f*x + 2*I*e) + f)

Mupad [B] (verification not implemented)

Time = 8.93 (sec) , antiderivative size = 76, normalized size of antiderivative = 1.29 \[ \int (a+i a \tan (e+f x)) (A+B \tan (e+f x)) (c-i c \tan (e+f x))^3 \, dx=-\frac {\frac {B\,a\,c^3\,{\mathrm {tan}\left (e+f\,x\right )}^4}{4}+\frac {a\,\left (A+B\,2{}\mathrm {i}\right )\,c^3\,{\mathrm {tan}\left (e+f\,x\right )}^3}{3}+\frac {a\,\left (-B+A\,2{}\mathrm {i}\right )\,c^3\,{\mathrm {tan}\left (e+f\,x\right )}^2}{2}-A\,a\,c^3\,\mathrm {tan}\left (e+f\,x\right )}{f} \]

[In]

int((A + B*tan(e + f*x))*(a + a*tan(e + f*x)*1i)*(c - c*tan(e + f*x)*1i)^3,x)

[Out]

-((a*c^3*tan(e + f*x)^3*(A + B*2i))/3 - A*a*c^3*tan(e + f*x) + (B*a*c^3*tan(e + f*x)^4)/4 + (a*c^3*tan(e + f*x
)^2*(A*2i - B))/2)/f